home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / !applications! / symphonie / dsplugin / dspplugin lp filter.s < prev    next >
Text File  |  1994-04-11  |  4KB  |  256 lines

  1. ; Simple DSP Filter algorithm v1.0
  2. ; Can be used for filtering, antialiasing or smoothing
  3.  
  4. ; Designed by Patrick Meng 96
  5.  
  6. ; Pretty well optimized for: Motorola CPU 020 - 060 (superscalar)
  7.  
  8.     ;- BEGIN -------------------------------------------------
  9.  
  10.     MC68020
  11.  
  12. SST_SYS_GetMem            EQU    0
  13. SST_SYS_FreeMem            EQU    4
  14.  
  15. SST_FILE_RequestFileName    EQU    100
  16. SST_FILE_SetReqPattern        EQU    104
  17. SST_FILE_SetReqDir        EQU    108
  18. SST_FILE_GetFileName        EQU    112
  19. SST_FILE_GetFileLen        EQU    116
  20.  
  21. SST_GFX_AssistText        EQU    200
  22. SST_GFX_AssistDecLong        EQU    204
  23. SST_GFX_AssistDecByte        EQU    208
  24. SST_GFX_AssistHexLong        EQU    212
  25.  
  26. SST_AUDIO_GetChunkLen        EQU    400
  27.  
  28. SST_PTR_EXECBASE        EQU    1600
  29. SST_PTR_INTBASE            EQU    1604
  30. SST_PTR_DOSBASE            EQU    1608
  31. SST_PTR_ASLBASE            EQU    1612
  32. SST_PTR_REQTOOLSBASE        EQU    1616
  33. SST_PTR_GFXBASE            EQU    1620
  34.  
  35. SST_PTR_Screen            EQU    1650
  36.  
  37. SST_ADR_ProcessorFlags        EQU    1800
  38. SST_ADR_SystemFrequency        EQU    1804
  39. SST_ADR_SystemBpm        EQU    1808
  40. SST_ADR_ChunkLen        EQU    1812
  41. SST_ADR_OversampleFlag        EQU    1816
  42.  
  43.  
  44. FASTMEM    EQU    $10004
  45. ANYMEM    EQU    $10000
  46.  
  47. CALLSST    macro
  48.     move.l    #SST_\1,d7
  49.     bsr    GoSST
  50.     endm
  51.  
  52. FLASH    macro
  53.     move.w    #$\1,$dff180
  54.     endm
  55.  
  56. BGN    macro
  57.     movem.l    d0-d7/a0-a6,-(a7)
  58.     endm
  59.  
  60. RET    macro
  61.     movem.l    (a7)+,d0-d7/a0-a6
  62.     rts
  63.     endm
  64.  
  65. puts    macro
  66.     movem.l    \1,-(sp)
  67.     endm
  68.  
  69. gets    macro
  70.     movem.l    (sp)+,\1
  71.     endm
  72.  
  73. acode    macro
  74.     CNOP 0,4
  75.     endm
  76.  
  77.  
  78.     dc.b    "Symphonie DSP Plugin"    ;MAGIC String    (PRIVATE)
  79.     dc.w    1,0            ;Version,Release (PRIVATE,DO NOT CHANGE)
  80.  
  81.     ;- DSPLIB -------------------------------------------------
  82.  
  83.     jmp    InitDSP(PC)        ;Allocate Mem, Build your Tables
  84.     jmp    CleanUpDSP(PC)        ;Free Mem
  85.  
  86.     jmp    ProcDsp(PC)        ;Process DSP algorithm (interrupt)
  87.  
  88.     jmp    GetDspTitle(PC)        ;Get DSP algorithm Title
  89.     jmp    ModifyValue(PC)        ;notify changed Value
  90.  
  91.     jmp    GraphSizeModify(PC)    ;notify graph size has changed
  92.     jmp    RefreshGraph(PC)    ;notify its time for a GFX update
  93.  
  94.     jmp    StartDSP(PC)        ;notify start
  95.     jmp    StopDSP(PC)        ;notify stop
  96.     dc.l    -1
  97.  
  98.     ;- CODE --------------------------------------------------
  99.  
  100.  
  101.     acode
  102. GoSST    puts    a6
  103.     move.l    SUPERSTBASE(PC),a6
  104.     move.l    (a6,d7.w),a6
  105.     jsr    (a6)
  106.     gets    a6
  107.     rts
  108. SUPERSTBASE    dc.l    0
  109.  
  110.  
  111.     acode
  112. StartDSP
  113.     lea.l    DspHPFilt_LASTSAMPLE(PC),a0
  114.     clr.l    (a0)
  115.     lea.l    On_TXT(PC),a0
  116.     CALLSST GFX_AssistText
  117.     rts
  118.  
  119.  
  120. StopDSP
  121.     lea.l    Off_TXT(PC),a0
  122.     CALLSST GFX_AssistText
  123.     rts
  124.  
  125.  
  126.  
  127.  
  128.     acode
  129.  
  130. GraphSizeModify
  131.     rts
  132.  
  133. RefreshGraph
  134.     rts
  135.  
  136. ModifyValue    ;INPUT (D0L,D1L)(VALUE, PARAMETER ID)
  137.     tst.w    d1
  138.     bne.s    .val1
  139.     lea.l    Volume(PC),a0
  140.     move.l    d0,(a0)
  141.     rts
  142. .val1    
  143.     lea.l    Volume+4(PC),a0
  144.     move.l    d0,(a0)
  145.     rts
  146.  
  147.  
  148. Volume    dc.l    1,1
  149.  
  150.  
  151. InitDSP        ;I(A0L)(SUPERSUPPORTTABLE_PTR)
  152.         ;O(A0L)(DSPGUI_PTR)
  153.  
  154.     lea.l    SUPERSTBASE(PC),a1
  155.     move.l    a0,(a1)
  156.  
  157.     lea.l    Welcome_TXT(PC),a0
  158.     CALLSST GFX_AssistText
  159.  
  160.     lea.l    DspHPFilt_LASTSAMPLE(PC),a0
  161.     clr.l    (a0)
  162.  
  163.     lea.l    Parameter_DEF(PC),a0
  164.     rts
  165.  
  166. CleanUpDSP    
  167.     rts
  168.  
  169. GetDspTitle    ;OUTPUT (A0L)(DSPTitle_TXT)
  170.     lea.l    DSPTitle(PC),a0
  171.     rts
  172.  
  173.  
  174.  
  175.     acode
  176. ProcDsp        ;INPUT (D0W,A1L)(SAMPLE_NUMB,SAMPLECHUNK_PTR)
  177.     puts    d0-a3
  178.  
  179.     lea.l    DspHPFilt_LASTSAMPLE(PC),a2
  180.  
  181.     move.l    Volume+4(PC),d3
  182.     ;moveq    #1,d3            ;Filter Intensity
  183.  
  184.  
  185.     move.l    (a2),d2            ;D2L    LASTSAMPLE
  186.     subq.w    #1,d0
  187.     move.w    d0,d6
  188.  
  189.  
  190.     move.l    Volume(PC),d7        ;Depth (Interation)
  191.     subq.w    #1,d7
  192.     bmi.s    .exit
  193.  
  194.     move.l    d2,d5
  195.     move.l    a1,a3
  196.  
  197. .loop    move.w    d6,d0
  198.     move.l    d5,d2
  199.     move.l    a3,a1
  200.  
  201. .loop2        move.l    (a1),d1
  202.  
  203.         move.l    d1,d4
  204.         sub.w    d2,d1
  205.         asr.w    d3,d1
  206.         sub.w    d1,d4
  207.         swap    d1
  208.         swap    d2
  209.         sub.w    d2,d1
  210.         asr.w    d3,d1
  211.         swap    d4
  212.         sub.w    d1,d4
  213.         swap    d4
  214.  
  215.         move.l    d4,(a1)+
  216.         move.l    d4,d2
  217.         dbf    d0,.loop2
  218.  
  219.     dbf    d7,.loop
  220.  
  221.     move.l    d4,(a2)
  222.  
  223. .exit    gets    d0-a3
  224.     rts
  225.  
  226. DspHPFilt_LASTSAMPLE    dc.l    0
  227.  
  228.  
  229.  
  230.     ;- GUI ------------------------------------------------------
  231.  
  232. Parameter_DEF
  233.     dc.b    "Depth",0
  234.     dc.b    0,0,0,1        ;init
  235.     dc.b    0,0,0,1        ;min
  236.     dc.b    0,0,0,8        ;max
  237.  
  238.     dc.b    "Level",0
  239.     dc.b    0,0,0,1        ;init
  240.     dc.b    0,0,0,1        ;min
  241.     dc.b    0,0,0,4        ;max
  242.  
  243.     dc.b    0        ;END OF GUI DEF
  244.  
  245.     ;- TITLE ----------------------------------------------------
  246.  
  247.  
  248.         dc.b    "$VER: "
  249. DSPTitle    dc.b    "Test Filter Dsp Plugin v1.0",0
  250. Welcome_TXT    dc.b    "Test Dsp: Filter",0
  251. On_TXT        dc.b    "LP Filter: On",0
  252. Off_TXT        dc.b    "LP Filter: Off",0
  253.         even
  254.  
  255.     END
  256.